import java.io.*;
/**
 * Created with IntelliJ IDEA.
 * Description: Java程序设计IO实验报告代码
 */
public class Test {
    public static void main(String[] args) throws IOException {
        // 字节流拷贝
        FileInputStream in = new FileInputStream("D:/src.txt");
        FileOutputStream out = new FileOutputStream("D:/des1.txt");
        byte[ ] buf = new byte[1024];
        int len;
        while ((len = in.read(buf)) != -1) {
            out.write(buf, 0, len);
        }
        in.close( );
        out.close( );
        // 字符流拷贝
        BufferedReader bf = new BufferedReader(new FileReader("D:/src.txt"));
        BufferedWriter bw = new BufferedWriter(new FileWriter("D:/des2.txt"));
        String str;
        while ((str = bf.readLine( )) != null) {
            bw.write(str);
            bw.newLine( );
        }
        bf.close( );
        bw.close( );
    }
}
